<?php

namespace common\models;

use Yii;
use common\components\behaviors\ImageBehavior;
/**
 * This is the model class for table "{{%goods}}".
 *
 * @property integer $id
 * @property integer $c_id
 * @property string $name
 * @property string $brand
 * @property string $standard
 * @property integer $img_id
 * @property string $desc
 * @property integer $create_time
 * @property integer $flag
 * @property integer $stock
 *   @property integer $price
 */
class DhGoods extends \common\components\ActiveRecord2015
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%goods}}';
    }

    public function behaviors() {
        return [
            'image' => [
                'class' => ImageBehavior::className()
            ]
        ];
    }
    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['c_id', 'name', 'stock'], 'required'],
            [['c_id', 'img_id', 'create_time', 'flag', 'stock'], 'integer'],
            [['desc'], 'string'],
            [['price'],'number'],
            [['name', 'brand', 'standard'], 'string', 'max' => 255]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'c_id' => 'C ID',
            'name' => '名称',
            'brand' => '品牌',
            'standard' => '规格',
            'img_id' => 'Img ID',
            'desc' => '描述',
            'create_time' => 'Create Time',
            'flag' => 'Flag',
            'stock' => '库存',
            'price'=>'价格'
        ];
    }
}
